package com.yibo.yunpicture.infrastructure.api.imageSearch;

import com.yibo.yunpicture.infrastructure.api.imageSearch.model.ImageSearchDTO;
import com.yibo.yunpicture.infrastructure.api.imageSearch.sub.GetImageFirstUrlApi;
import com.yibo.yunpicture.infrastructure.api.imageSearch.sub.GetImageListApi;
import com.yibo.yunpicture.infrastructure.api.imageSearch.sub.GetImagePageUrlApi;

import java.util.List;

public class ImageSearchApiFacade {

    public static List<ImageSearchDTO> searchImage(String imageUrl) {
        String imagePageUrl = GetImagePageUrlApi.getImagePageUrl(imageUrl);
        String imageFirstUrl = GetImageFirstUrlApi.getImageFirstUrl(imagePageUrl);
        return GetImageListApi.getImageList(imageFirstUrl);
    }

    public static void main(String[] args) {
        String imageUrl = "https://www.codefather.cn/logo.png";
        List<ImageSearchDTO> imageSearchDTOList = searchImage(imageUrl);
        System.out.println("imageSearchDTOList:"+imageSearchDTOList);
    }
}
